<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>继承对新增对象的影响</title>
  </head>
  <body></body>
  <script>
    function User() {
      this.name = name;
    }
    User.prototype.name = function() {
      console.log("user.name");
    };
    function Admin() {}
    let a = new Admin();
    Admin.prototype.__proto__ = User.prototype;
    // Admin.prototype = Object.create(User.prototype);
    Admin.prototype.role = function() {
      console.log("admin.name");
    };
    console.log(a);
    a.name();
    a.role();
  </script>
</html>
